<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport"/>
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>我要提现</title>
    <link rel="stylesheet" href="/index/css/common.css?v=2">
    <link rel="stylesheet" href="/index/css/take_money.css?v=5">

</head>
<body>
<div class="tabsBox">
    <div class="topTab">
        <div class="tabLeft">
            <img src="/index/assets/left.png">
        </div>
        <div class="tabCenters">我要提现</div>
        <!-- <div class="tabRight">收益说明</div> -->
    </div>
</div>
<div class="withdrawal">
    <div class="tixanBox">
        <div class="tixianInfor">
            <div class="tixianTitle">提现账号</div>
            <div class="tabList">
                {if empty($wx.wx_openid)}
                <div class="tabs on" type="2"><span>支付宝</span></div>

                {else/}
                <!--<div class="tabs" type="1"><span>微信</span></div>-->
                <div class="tabs on" type="2"><span>支付宝</span></div>
                {/if}
            </div>
        </div>


        {if !empty($wx.wx_openid)}
        <div class="shouquanBox ">
            <div class="shouquan ">
                <img src="/index/assets/icon/wechat.png">
                <!--<img src="{$wx.wx_avatar}" alt="" style="margin-left:10px;">-->
                <span>{$wx.wx_nickname}</span>
                <!--<div class="shouquanBtn">-->
                <!--<div class="sq">授权</div>-->
                <!--</div>-->
            </div>
        </div>
        {/if}
        <!--<div class="shouquanBox {if empty($wx.wx_openid)} active{/if} alipay">-->
        <div class="shouquanBox  active alipay">
            <div class="shouquan ">
                <img src="/index/assets/icon/alipay.png">
                <!--<span>auiomasd</span>-->

                <!--<div class="shouquanBtn">-->
                <!--<div class="sq">授权</div>-->
                <!--</div>-->
                <div class="account">
                    <input type="text" placeholder="支付宝账号" id="account_num" value="{$alipay.account_num}">
                    <input type="text" placeholder="真实姓名" id="real_name" value="{$alipay.real_name}">
                </div>
            </div>

        </div>

    </div>
    <div class="moneyBox">
        <div class="moneyTitle">提现金额<span>（我的账户余额：{$money}元）</span></div>
        <div class="write">
            <span style="color:#aaa">￥</span><input type="number" id="money">
        </div>
        <div class="tishiBox">
            <div class="tishiTitle">温馨提示</div>
            <p>1.低于10元不得提现，发起提现需为10的倍数，例：100元。</p>
            <p>2.黄金会员单笔最大为500元，合伙人每天为800元，股东为1000元。</p>
            <p>3.每日可提现次数为1笔。</p>
            <p>4.发起提现后24小时内到账，周末/节假日顺延到工作日提现</p>
            <div class="shenqingBtn">申请提现</div>
            <div class="tixianHistory"><a href="{:url('wallet')}">提现记录</a></div>
        </div>
    </div>
</div>
{include file='common/toast'}
</body>
<script type="text/javascript" src="/index/js/jquery-3.4.1.min.js"></script>
<script type="text/javascript" src="/index/js/common.js"></script>
<script type="text/javascript">
    $(function () {
        $('.tabs').click(function () {
            return;
            var index = $(this).index();
            $(this).addClass("on").siblings().removeClass("on");
            $(".shouquanBox").eq(index).addClass("active").siblings().removeClass("active");
        })


        //申请提现
        $('.shenqingBtn').click(function () {

            var type = $('.on').attr('type');
            var money = $('#money').val();

            var data = {
                type: type,
                money:money
            };
            if (type == 2) {

                data.account_num = $('#account_num').val()
                data.real_name = $('#real_name').val()


                if (!data.account_num) {
                    toastFail('请输入支付宝账号');
                    $('#account_num').focus();
                    return;
                }

                if (!data.real_name) {
                    toastFail('请输入真实姓名');
                    $('#real_name').focus();
                    return;
                }

            }


            if (!money || money <= 0) {
                toastFail('请输入提现金额');

                $('#money').focus();
                return;
            }

            if (money > parseInt('{$money}')) {

                toastFail('账户余额不足');
                $('#money').focus();
                return;
            }

            if (money % 10 > 0) {
                toastFail('提现金额需为10的倍数');
                $('#money').focus();
                return;
            }

            $.post('{:url("takeMoney")}', data, function (res) {

                if (res.code == 1) {
                    toastSuccess('申请成功', '{:url("wallet")}');

                } else {
                    toastFail(res.msg);
                }
            }, 'json')

        })
    })
</script>
</html>